﻿<%@ Page Language="C#" MasterPageFile="~/MainMaster.Master" AutoEventWireup="true"
    CodeBehind="BoardCyc.aspx.cs" Inherits="Mang24k99.Web.PUBC.BoardCyc" Title="调查表周期维护" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <script type="text/javascript">
        function TextClear(oEvent,defultText)
        {  
            //如果当前值为默认值，则清空 
            var obj=oEvent.srcElement ? oEvent.srcElement : oEvent.target;
            with(obj) 
            if(value==defultText) value="" 
        }
        function TextRes(oEvent,defultText)
        { 
             //如果值为空，则赋默认值
            var obj=oEvent.srcElement ? oEvent.srcElement : oEvent.target;
            with(obj) 
            if(value=="") value=defultText 
        }
        function verify(obj)
        {
          if(!(obj.keyCode>=48 && obj.keyCode<=57))
          {
              obj.returnValue = false;
          } 
        }
        
    </script>
    <asp:Panel ID="Panel1" runat="server">
         <asp:Button ID="btnAdd" runat="server"  CssClass="form_btn" Text="新增周期" 
             onclick="btnAdd_Click" />
    </asp:Panel>
    <table align="center">
        <tr>
            <td class="tb_title1">
                所属调查表
            </td>
            <td class="tb_txt1">
                <asp:DropDownList ID="ddlBoardType" runat="server" AutoPostBack="true" 
                    onselectedindexchanged="ddlBoardType_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <asp:Panel ID="Panel2" runat="server">
        <asp:Button ID="btnBack" runat="server" CssClass="form_btn" Text="返回列表" 
            onclick="btnBack_Click" />
        <table width="100%">
            <tr>
                <td class="tb_title1" style="width:20%">
                    周期类型：
                </td>
                <td class="tb_txt1">
                    <asp:DropDownList ID="ddlCycType" runat="server" AutoPostBack="true">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    周期名称：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtCycName" runat="server" MaxLength="50" Width="90%"></asp:TextBox>
                    <asp:TextBox ID="txtCycno" runat="server" CssClass="hidden"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    周期简称：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtCycAlias" runat="server" MaxLength="15" Width="50%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    限制方式：
                </td>
                <td class="tb_txt1">
                    <asp:DropDownList ID="ddlLimitType" runat="server" AutoPostBack="true">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    限制次数：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtLImitNum" runat="server" MaxLength="3" Width="50%" onkeypress="verify(event)"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    投票成功信息：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtSuccessMsg" runat="server" MaxLength="50" Width="90%"
                        Text="上限50个汉字" onfocus="TextClear(event,'上限50个汉字')" onblur="TextRes(event,'上限50个汉字')"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    投票失败信息：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtFailureMsg" runat="server" MaxLength="50" Width="90%"
                        Text="上限50个汉字" onfocus="TextClear(event,'上限50个汉字')" onblur="TextRes(event,'上限50个汉字')"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tb_title1">
                    投票次数超限信息：
                </td>
                <td class="tb_txt1">
                    <asp:TextBox ID="txtOverNumMsg" runat="server" MaxLength="50" Width="90%"
                        Text="上限50个汉字" onfocus="TextClear(event,'上限50个汉字')" onblur="TextRes(event,'上限50个汉字')"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnSave" CssClass="form_btn" runat="server" Text="新增" OnClick="btnSave_Click" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" CssClass="form_btn" runat="server" Text="取消"
                        OnClientClick="return confirm('未保存的操作将丢失，确定取消吗')" OnClick="btnCancel_Click" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="Panel3" runat="server">
        <div>
            <asp:GridView ID="grdList" runat="server"  AutoGenerateColumns="False" 
                Width="100%" onrowcommand="grdList_RowCommand">
                <HeaderStyle CssClass="tb_title2" />
                <RowStyle CssClass="tb_txt2" />
                 <Columns>
                    <asp:TemplateField HeaderText="序号">
                        <ItemTemplate>
                            <%#Container.DataItemIndex+1%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="CycNO" HeaderText="周期编号" />
                    <asp:BoundField DataField="CycName" HeaderText="周期名称" />
                    <asp:BoundField DataField="CycAlias" HeaderText="简称" />
                    <asp:BoundField DataField="TargetNum" HeaderText="指标数" />
                    <asp:TemplateField HeaderText="维护条目">
                        <ItemTemplate>
                            <a href="BoardItems.aspx?no=<%# Eval("CycNO")%>">维护条目</a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="维护详细信息">
                        <ItemTemplate>
                            <asp:LinkButton ID="lkbtnEdit" runat="server" CommandName="Modi" 
                                CommandArgument='<%# Eval("CycNO")%>'>维护详细信息
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="删除">
                        <ItemTemplate>
                            <asp:LinkButton ID="lkbtnDel" runat="server" CommandName="Del" 
                                    OnClientClick="return confirm('删除该周期会同时删除该周期下的条目，确定删除吗？')" CommandArgument='<%# Eval("CycNO")%>'>删除
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>   
    </asp:Panel>
</asp:Content>
